home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Environments / Clean 1.2.4 / MacInterface / memory.icl < prev    next >
Encoding:
Modula Implementation  |  1997-02-14  |  1.8 KB  |  58 lines  |  [TEXT/3PRM]

  1. implementation module memory;
  2.  
  3. import mac_types;
  4.  
  5. NewHandle :: !Int !Toolbox -> (!Handle,!Int,!Toolbox);
  6. NewHandle logicalSize t = code (logicalSize=D1,t=D0)(handle=D2,result_code=D1,z=Z){
  7.     instruction 0x2001    ||    move.l    d1,d0
  8.     instruction 0xA122    ||    _NewHandle
  9.     instruction 0x2408    ||    move.l    a0,d2
  10.     instruction 0x2200    ||    move.l    d0,d1
  11. };
  12.  
  13. DisposHandle :: !Handle !Toolbox -> (!Int,!Toolbox);
  14. DisposHandle h t = code (h=D1,t=U)(result_code=D1,z=Z){
  15.     instruction 0x2041    ||    move.l    d1,a0
  16.     instruction 0xA023    ||    _DisposHandle
  17.     instruction 0x2200    ||    move.l    d0,d1
  18. };
  19.  
  20. NewPtr :: !Int !Toolbox -> (!Ptr,!Int,!Toolbox);
  21. NewPtr logicalSize t = code (logicalSize=D1,t=U)(pointer=D2,result_code=D1,z=Z){
  22.     instruction 0x2001    ||    move.l    d1,d0
  23.     instruction 0xA11E    ||    _NewPtr
  24.     instruction 0x2408    ||    move.l    a0,d2
  25.     instruction 0x2200    ||    move.l    d0,d1
  26. };
  27.  
  28. DisposPtr :: !Ptr !Toolbox -> (!Int,!Toolbox);
  29. DisposPtr p t = code (p=D1,t=U)(result_code=D1,z=Z){
  30.     instruction 0x2041    ||    move.l    d1,a0
  31.     instruction 0xA01F    ||    _DisposPtr
  32.     instruction 0x2200    ||    move.l    d0,d1
  33. };
  34.  
  35. GetHandleSize :: !Handle !Toolbox -> (!Int,!Toolbox);
  36. GetHandleSize handle t = code (handle=D1,t=U)(result_code=D1,z=Z){
  37.     instruction 0x2041    ||    move.l    d1,a0
  38.     instruction 0xA025
  39.     instruction 0x2200    ||    move.l    d0,d1    
  40. }
  41.  
  42. GetPtrSize :: !Int !Toolbox -> (!Int,!Toolbox);
  43. GetPtrSize p t = code (p=D1,t=U)(size=D1,z=Z){
  44.     instruction 0x2041    ||    move.l    d1,a0
  45.     instruction 0xA021    ||    _GetPtrSize
  46.     instruction 0x2200    ||    move.l    d0,d1
  47. };
  48.  
  49. copy_handle_data_to_string :: !{#Char} !Handle !Int !Toolbox -> Toolbox;
  50. copy_handle_data_to_string string handle size t0 = code (string=A0,handle=D2,size=D1,t0=U)(t1=Z){
  51.     instruction    0x2248        ||    move.l    a0,a1
  52.     instruction    0x2042        ||    move.l    d2,a0
  53.     instruction    0x5089        ||    addq.l    #8,a1
  54.     instruction    0x2050        ||    move.l    (a0),a0
  55.     instruction    0x2001        ||    move.l    d1,d0
  56.     instruction 0xA22E        || BlockMoveData
  57. };
  58.